
export const getParents = (routes, path, tag = 'activeMenu') => {
  // 现在不想处理嵌套路由格式问题
  let list = []
  for (let key in routes) {
    if (routes[key].path === path) {
      list.push(routes[key])
      if ('meta' in routes[key] && tag in routes[key].meta) {
        let parent = getParents(routes, routes[key].meta[tag], tag)
        list = parent.concat(list)
      } else {
        break
      }
    } else if ('children' in routes[key] && routes[key].children.length > 0) {
      let parent = getParents(routes[key].children, path, tag)
      list = parent.concat(list)
    }
  }
  return list
}
